#ifndef _core_switch_detail_size_impl_hpp_
#define _core_switch_detail_size_impl_hpp_

/** \file size_impl.hpp
 *  \author Adrian Schweizer
 *  \created  $Mo 11 Feb 08:33:01 pm CET 2008 schwadri@SchwadriLaptop.local$
 *  \modified $Mo 11 Feb 08:39:14 pm CET 2008 schwadri@SchwadriLaptop.local$
 */

#include <boost/mpl/size_t.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include "tag_of.hpp"
#include "is_sequence_impl.hpp"

namespace core {

    struct case_tag;

}

namespace boost { namespace fusion { namespace extension {

    template <typename Tag>
        struct size_impl;

    template <>
        struct size_impl<core::case_tag>
        {
            template <typename Case>
                struct apply
                :   mpl::plus<
                                mpl::size<typename Case::labels>,
                                typename mpl::if_<   traits::is_sequence<typename Case::next>,
                                                apply<typename Case::next>,
                                                mpl::size_t<0>
                                            >::type
                            >
                { };
        };

}}}
#endif // _core_switch_detail_size_impl_hpp_
